import { applyMiddleware, combineReducers, legacy_createStore as createStore } from 'redux';
import thunk from 'redux-thunk';
import { serverReducer } from './server/serverReducer';
import { productReducer } from './product/productReducer';

import { categoryReducer } from './category/categoryReducer'

//合并reducer数据
const allReducer = combineReducers({
    serverData: serverReducer,
    productData: productReducer,
    cateData: categoryReducer
})

//配置异步函数中间件
const middleware = applyMiddleware(thunk);

//创建仓库
const store = createStore(allReducer, middleware)

export default store